package com.chilli.cosima.service.impl;

import java.util.Map;

import com.chilli.cosima.common.BussinessException;
import com.chilli.cosima.data.bean.Customer;
import com.chilli.cosima.data.dao.CustomerDAO;
import com.chilli.cosima.service.CustomerService;

public class CustomerServiceImpl implements CustomerService
{
	private CustomerDAO customerDAO;

	public CustomerDAO getCustomerDAO()
	{
		return customerDAO;
	}

	public void setCustomerDAO(CustomerDAO customerDAO)
	{
		this.customerDAO = customerDAO;
	}

	public Long createCustomer(Customer customer) throws BussinessException
	{
		return customerDAO.createCustomer(customer);
	}

	public void deleteCustomer(Long id) throws BussinessException
	{
		customerDAO.deleteCustomer(id);
	}

	public Customer findCustomerById(Long id)
	{
		return customerDAO.findCustomerById(id);
	}

	@SuppressWarnings("unchecked")
	public Map findCustomerByPage(int current, int pageSize)
	{
		return customerDAO.findCustomerByPage(current, pageSize);
	}

	@SuppressWarnings("unchecked")
	public Map findCustomerByPageAndQUery(int current, int pageSize,
			String customer)
	{
		return customerDAO.findCustomerByPageAndQuery(current, pageSize,
				customer);
	}

	public void updateCustomer(Customer customer) throws BussinessException
	{
		customerDAO.updateCustomer(customer);
	}

}
